<?php

namespace Yyz\test\src\YiYunzhang;
use Yyz\YiYunzhang\Client;

class RunTest
{
    protected $host = 'https://api.ecloudsign.cn/';
    protected $AppKey = 'yyzzs27fmis1woqk574l';
    protected $secret = '6853ed84172585cc743d7b108ba16ea5';

    /**
     * Notes: 申请证书
     * @author: MagicConch17
     * @date: 2020/10/30 14:38
     */
    public function applyCertificateTest($postData,$url='',$method = 'post')
    {

        try {
            if($method =='post'){
                $result = (new Client($this->AppKey, $this->secret))->post($this->host . $url, $postData, function ($data) {
                    // 方法提供了一个 回调方法 默认 转换json 数据 返回
                    return json_decode($data,true);
                });
            }else{
                $result = (new Client($this->AppKey, $this->secret))->get($this->host . $url, $postData, function ($data) {
                    // 方法提供了一个 回调方法 默认 转换json 数据 返回
                    return json_decode($data,true);
                });
            }

            return json_decode($result,true);
        } catch (\Exception $exception) {
            var_dump($exception->getMessage());
        }
    }
}
